package com.superpai.view.adapter;

import java.util.List;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.superpai.R;
import com.superpai.domain.Content;

/**
 * @author Devin.Hu
 * @date 2011-9-27
 * @version V1.0
 * @description 满减满送adapter
 */
public class ConvenienceAdapter extends BaseAdapter {

	private Context mContext;
	private LayoutInflater mInflater;
	private List<Content> contentList;
	
	private ImageView cart_item_img;
	private TextView cart_item_title;
	private TextView cart_item_price;
	private TextView cart_item_size;
	private TextView cart_item_number;

	public ConvenienceAdapter(Context context) {
		this.mContext = context;
		mInflater = LayoutInflater.from(mContext);
	}

	
	public List<Content> getContentList() {
		return contentList;
	}

	public void setContentList(List<Content> contentList) {
		this.contentList = contentList;
	}

	@Override
	public int getCount() {
		if (null != contentList) {
			return contentList.size();
		}
		return 0;
	}

	@Override
	public Object getItem(int position) {
		if (null != contentList) {
			return contentList.get(position);
		}
		return null;
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		convertView = mInflater.inflate(R.layout.cart_item, null);
		cart_item_img = (ImageView) convertView.findViewById(R.id.cart_item_img);
		cart_item_title = (TextView) convertView.findViewById(R.id.cart_item_title);
		cart_item_price = (TextView) convertView.findViewById(R.id.cart_item_price);
		cart_item_size = (TextView) convertView.findViewById(R.id.cart_item_size);
		cart_item_number = (TextView) convertView.findViewById(R.id.cart_item_number);

//		cart_item_img.setTag(contentList.get(position).getPimg());
//		cart_item_title.setText(contentList.get(position).getPname());
//		cart_item_price.setText("￥" + contentList.get(position).getPrice() + "元");
//		cart_item_number.setText("数量：" + contentList.get(position).getPnum());
//		cart_item_size.setText("尺码：" + contentList.get(position).getPnum());


//		new AsyncImageLoader().execute(cart_item_img);
		return convertView;
	}

}
